//2009/08/26 10:46:04
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class TwoRotationCypher
{
public:
    string encrypt(int firstSize, int firstRotate, int secondRotate, string message)
    {
        vector<char> v;
        for (int i=0; i<26; i++) v.push_back('a' + i);
        for (int i=0; i<firstSize; i++) v[i] = (v[i] + firstRotate - 'a') % firstSize + 'a';
        for (int i=firstSize; i<26; i++) v[i] = (v[i] + secondRotate - 'a' - firstSize) % (26 - firstSize) + 'a' + firstSize;
        for (int i=0; i<26; i++) cout << v[i] << ", ";
        cout << endl;
        string ret;
        for (int i=0; i<message.size(); i++)
            if (isalpha(message[i]))
                ret += v[message[i]-'a'];
			else 
				ret += message[i];
        return ret;
    }
};
